From: "Stefan Stuntz"Date: Sat, 24 Feb 1996 17:49:12 +0100 X-Mailer: IntuiNews 1.3b Beta 5 (3.1.96) Subject: Re: MUI GUI for all prefs programs Message-Id: <81319648@magic.informatik.tu-muenchen.de> Organization: Home of MUI Resent-Message-Id: <"WsFnl2.0.FR5.VmMCn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/413 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 684 X-Lines: 22 Status: RO eleve5 wrote in article <9602231238.AA00271@woody.ensea.fr>: > How can i use the dataspace class, to restore my data. > I saw a MUIM_DataSpace_Find in the autodocs but there is > no define for it in the includes file. Indeed. What a mess... :) #define MUIM_Dataspace_Find 0x8042832c /* V11 */ struct MUIP_Dataspace_Find { ULONG MethodID; ULONG id; }; You call it with the id that you wanna look for and get the thing you added as result or NULL if the id is not found in the dataspace. > What about a example to make preference for custom class ? Someone wanted to write a real nice example but this person still sucks... Hey... kmel... can you hear me? -- Greetings, Stefan From: "Stefan Stuntz" Date: Thu, 18 Apr 1996 21:02:30 +0100 X-Mailer: IntuiNews 1.3b Beta 7 (2.2.96) Subject: Re: Config Items Message-Id: <81321194@magic.informatik.tu-muenchen.de> Organization: Home of MUI Resent-Message-Id: <"Br6HN1.0.NB2.VBfTn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1090 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 744 X-Lines: 20 Status: RO Kai Hofmann wrote in article <60805420@informatik.uni-bremen.de>: > For MonthNavigator.mcc I want to include an uninstall feature in the > installer script. > But for a perfect uninstall I think there is a need for removing the > configuration items. > > Any legal way to do that with a small special utility? Not yet. Just leave them where they are, maybe I'll work on something to remove obsolete config items from mui prefs files sometimes. BTW, you should be prepared to receive anything when querying for your configuration, dont rely on reasonable values in your dataspaces. Programs should not crash just because some config files are broken. Unfortunately, it seems MUI itself has this problem sometimes... :) -- Greetings, Stefan Subject: Method madness: the Truth Message-Id: <79810034%agos001@pn.itnet.it> Resent-Message-Id: <"UHg5f2.0.bM.WP9fn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1388 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 6380 X-Lines: 178 Status: RO Ok things work in this way: . To save a Data instance,a program invokes on it Data_Save . Data_Save opens the file,does some other things then calls Data_WriteChunk . Data_WriteChunk is defined on a per Data subclass basis (that is each Data subclass define it) . As an example I supply Race_WriteChunk,which calls DataList_WriteChunk . DataList_WriteChunk calls on each entry Property_WriteChunkBytes which is defined on a per Property subclass basis . As an example I supply Race_Stat_WriteChunkBytes Hope you'll have the patience to study this :-) With n--> I've highlited the methods chain 0--> STATIC ULONG Data_Save(struct IClass *cl,Object *obj,struct MUIP_Data_IO *msg) { ULONG rv = 1; if(msg->filename) { struct IFFHandle *iff = NULL; LONG error; iff = AllocIFF(); if(!iff) rv = IFFERR_NOMEM; else { iff->iff_Stream = (ULONG) Open(msg->filename, MODE_NEWFILE); if(iff->iff_Stream) { InitIFFasDOS(iff); error = OpenIFF(iff, IFFF_WRITE); if(error == 0) { ULONG formid; get(obj,MUIA_Data_FORMID,&formid); /* start the data FORM chunk */ error = PushChunk(iff,formid,ID_FORM,IFFSIZE_UNKNOWN); if(error == 0) { struct DataCore dc = {0}; dc.dc_id = xget(obj,MUIA_Data_InstID); strcpy(dc.dc_name,(STRPTR)xget(obj,MUIA_Data_InstName)); error = PushChunk(iff,formid,ID_CORE,sizeof(struct DataCore)); if(error == 0) { error = WriteChunkBytes(iff,&dc,sizeof(struct DataCore)); if(error == sizeof(struct DataCore)) { error = PopChunk(iff); if(error == 0) 1--> DoMethod(obj,MUIM_Data_WriteChunk,iff); else rv = error; } else rv = error; } else rv = error; /* end the data FORM chunk */ error = PopChunk(iff); if(error) rv = error; } else rv = error; CloseIFF(iff); } else rv = error; Close(iff->iff_Stream); } else rv = 0; FreeIFF(iff); } } else rv = 0; return(rv); } STATIC ULONG Race_WriteChunk(struct IClass *cl,Object *obj,struct MUIP_Data_IFF *msg) { struct Race_Data *data = INST_DATA(cl,obj); struct Diskable d; LONG error; 2--> DoMethod(data->dl_stat,MUIM_DataList_WriteChunk,msg->iff); DoMethod(data->dl_magicrealm,MUIM_DataList_WriteChunk,msg->iff); get(data->poison ,MUIA_Numeric_Value,&d.poison); get(data->disease,MUIA_Numeric_Value,&d.disease); get(data->backoptions,MUIA_Numeric_Value,&d.backoptions); get(data->bdprog,MUIA_Progression_Values,&d.bdprog); error = PushChunk(msg->iff,xget(obj,MUIA_Data_FORMID),ID_BULK,sizeof(struct Diskable)); if(error == 0) { error = WriteChunkBytes(msg->iff,&d,sizeof(struct Diskable)); if(error == sizeof(struct Diskable)) error = PopChunk(msg->iff); } return(0); } STATIC ULONG DataList_WriteChunk(Class *cl,Object *obj,struct MUIP_Data_IFF *msg) { struct DataList_Data *dlist = INST_DATA(cl,obj); struct DataList_Entry *dle; ULONG chunkid,i,formid; chunkid = GetPropCHUNKID(dlist->dl_propid); formid = GetDataFORMID(GetPropDID(dlist->dl_propid)); for(i=0;;i++) { DoMethod(obj,MUIM_List_GetEntry,i,&dle); if(!dle) break; if(dle->dle_prop) { PushChunk(msg->iff,formid,chunkid,IFFSIZE_UNKNOWN); 3--> DoMethod(dle->dle_prop,MUIM_Property_WriteChunkBytes,msg->iff); PopChunk(msg->iff); } } return(0); } 5--> STATIC ULONG Property_WriteChunkBytes(struct IClass *cl,Object *obj,struct MUIP_Data_IFF *msg) { struct Property_Data *data = INST_DATA(cl,obj); WriteChunkBytes(msg->iff,(APTR)&data->instid,sizeof(ID)); return(0); } STATIC ULONG Race_Stat_WriteChunkBytes(struct IClass *cl,Object *obj,struct MUIP_Data_IFF *msg) { struct Race_Stat_Data *data = INST_DATA(cl,obj); struct Diskable d; 4--> DoSuperMethodA(cl,obj,msg); /* Here my Amiga is locked out,a guru sometimes */ get(data->bonus,MUIA_Numeric_Value,&(d.bonus)); WriteChunkBytes(msg->iff,(APTR)&d,sizeof(struct Diskable)); return(0); } Cheers Stefano +--------------------------+-------------------------------------------+ | Stefano Agostinelli | Now developing for You ARM : | | Physics Dep. - Genoa | the state of art Amiga Role Master System | +--------------------------+-------------------------------------------+ | IRC: arm | WWW: www.geocities.com/SiliconValley/3630 | | E-M: agos001@pn.itnet.it | Look at Stefano.html and ARM.html | +--------------------------+-------------------------------------------+ Subject: Re: Method madness: the Truth References: <79810034%agos001@pn.itnet.it> X-Homemail: mailto:efp90@nuke.dircon.co.uk X-Url: http://www.users.dircon.co.uk/~nuke/ Resent-Message-Id: <"86tOZ2.0.v97.AEkgn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1417 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 154 Status: RO Content-Type: text/plain Content-Length: 4648 Stefano Agostinelli wrote: > Ok things work in this way: > . To save a Data instance,a program invokes on it Data_Save > . Data_Save opens the file,does some other things then calls > Data_WriteChunk . Data_WriteChunk is defined on a per Data subclass > basis (that is each Data subclass define it) > . As an example I supply Race_WriteChunk,which calls > DataList_WriteChunk . DataList_WriteChunk calls on each entry > Property_WriteChunkBytes which is defined on a per Property > subclass basis . As an example I supply Race_Stat_WriteChunkBytes Very interesting, I've done something similar, not using DataSpace, for generic BOOPSI (and MUI) objects; you can actually store and restore whole objects on a stream (I've created a BOOPSI Stream classes library too!), i.e. DoMethod(ostream, MUIM_Stream_StoreObj, obj); and later obj = DoMethod(istream, MUIM_Stream_ReadObj); or obj = DoMethod(istream, MUIM_Stream_ReadObjTags, MUIA_...); The whole system works using ClassDescriptors registered with a central (process local) database, containing the Class name and IClass *, allowing private Classes to be archived too. If you are familiar with C++ or Objective-C streams all this stuff will be familiar. My streaming stuff even handles multiple references to objects (object only gets stored once, second time just a reference is written, on restore the pointer just gets pointed to the same place). Basically all you need to do in your classes, pure BOOPSI or MUI is support the MUIM_Foundation_StoreOn and MUIM_Foundation_ReadFrom methods, and slightly modify the constructor to handle the request for dearchiving: struct MUIM_Foundation_ReadFrom {ULONG MethodID; TagItem *tags); struct MUIM_Foundation_StoreOn {ULONG MethodID; Object *ostream); // normal constructor PRIVATE Object *MyClass_Contructor(struct IClass *cl, Object *obj, struct opSet *msg) { struct TagItem *taglist = msg->ops_Attrs; // check for de-streaming request if(FindTagItem(MUIA_Foundation_ReadFrom, taglist) { // could just be function call... return (Object *) CoerceMethod(cl,obj, MUIM_Foundation_ReadFrom, taglist); }; // normal constuctor follows obj = DoSuperMethod(... } // stream constructor PRIVATE Object *MyClass_ReadFrom(struct IClass *cl, Object *obj, struct MUIP_Foundation_ReadFrom *msg) { struct TagItem *taglist = msg->tags; Object *istream = GetTagData(MUIA_Foundation_ReadFrom, 0, taglist); // can pass extra tags in here... if(obj = DoSuperNew(cl, obj, TAG_MORE, taglist)) { struct MyClass_Data *data = INST_DATA(cl, obj); memset(data, 0, sizeof(*data)); // can process special attributes here... data->myhookfunction = (struct Hook *) GetTagData(MUIA_MyClass_Hook, 0, taglist); data->classpool = (VOID *)cl->cl_UserData; // restore our data data->my_long = DoMethod(istream, MUIM_Stream_GetLong); data->my_string = DoMethod(istream, MUIM_Stream_GetString, data->classpool); if(xget(istream, MUIA_Stream_Error) == 0) { if(my_obj = DoMethod(istream, MUIM_Stream_ReadObj)) { return obj; }; }; CoerceMethod(cl,obj, OM_DISPOSE); }; return 0; } The streaming is simple: // stream storer method PRIVATE BOOL MyClass_StoreOn(struct IClass *cl, Object *obj, struct MUIP_Foundation_StoreOn *msg) { if(DoSuperMethod(cl,obj,(Msg)msg)) { struct MyClass_Data *data = INST_DATA(cl,obj); Object *ostream = msg->ostream; if(DoMethod(ostream, MUIM_Stream_PutLong, data->my_long) && DoMethod(ostream, MUIM_Stream_PutString, data->my_string) && DoMethod(ostream, MUIM_Stream_StoreObj, data->my_obj) { return TRUE; }; }; return FALSE; } For `dumb' classes and super-classes, obviously you can store the superclass attributes at a higher level. All this is working now (in my program!!) and will be available (free) around the middle of June if anyone is interested, as well as this I have foundation classes for LinkedLists, StringPairLists, Mutable Strings, plus all the stream classes (FileStream, BoundedFileStream). I'm really busy coding the program that will use all this stuff, but please mail me if you are at all interested or want further information.... Stefan; can I get some public tag-values for this stuff? I'm using my MUI registration number as a base at the moment... Ellis. Subject: len in MUIM_Dataspace_Add for MUIA_Pendisplay_Spec ? Mime-Version: 1.0 Date: Wed, 29 May 96 10:58:42 +0200 Sender: masson@iut-soph.unice.fr X-Mts: smtp Resent-Message-Id: <"5eY3s.0.Wt6.i91hn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1424 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE X-Lines: 19 Status: RO Content-Type: text/plain; charset="us-ascii" Content-Length: 330 Hi, when saving a MUIA_Pendisplay_Spec to dataspace with DoMethod(obj,MUIM_Dataspace_Add,APTR data, LONG len, ULONG id); should the len be : - MUIA_Pendisplay_Spec string lenght (and 4 for a LONG when not a string) - sizeof(struct MUI_PenSpec) - biggest of the two ??? regards, Gilles MASSON Subject: Re: len in MUIM_Dataspace_Add for MUIA_Pendisplay_Spec ? Message-Id: <81322399@magic.informatik.tu-muenchen.de> Organization: Home of MUI Resent-Message-Id: <"JkC9o1.0.JM1.wK4hn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1426 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 472 X-Lines: 17 Status: RO Gilles MASSON wrote in article <199605290858.KAA04211@ogpsrv.unice.fr>: > when saving a MUIA_Pendisplay_Spec to dataspace with > > DoMethod(obj,MUIM_Dataspace_Add,APTR data, LONG len, ULONG id); > > should the len be : > - MUIA_Pendisplay_Spec string lenght (and 4 for a LONG when not a string) > - sizeof(struct MUI_PenSpec) > - biggest of the two Of course len must be sizeof(struct MUI_PenSpec). Nobody guarantees that a penspec is a string. -- Greetings, Stefan Subject: Re: len in MUIM_Dataspace_Add for MUIA_Pendisplay_Spec ? Message-Id: <81322416@magic.informatik.tu-muenchen.de> Organization: Home of MUI Resent-Message-Id: <"zKTkl1.0.8m2.GPRhn"@sunsite> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.DE Reply-To: mui@sunsite.Informatik.RWTH-Aachen.DE X-Mailing-List: archive/latest/1431 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.DE Content-Type: text Content-Length: 734 X-Lines: 23 Status: RO Gilles MASSON wrote in article <199605291307.PAA09348@ogpsrv.unice.fr>: > > > DoMethod(obj,MUIM_Dataspace_Add,APTR data, LONG len, ULONG id); > > > > > > should the len be : > > > - MUIA_Pendisplay_Spec string lenght (and 4 for a LONG when not a string) > > > - sizeof(struct MUI_PenSpec) > > > - biggest of the two > > > > Of course len must be sizeof(struct MUI_PenSpec). Nobody guarantees that > > a penspec is a string. > > Ok for sizeof(struct MUI_PenSpec), but what happen when it's a string lenght > if bigger than it ? What the hell... ** THERE IS NO STRING ** A MUI_PenSpec is a black box structure with exactly sizeof(struct MUI_PenSpec) bytes, not a single byte more and not a single byte less. -- Greetings, Stefan From: "Stefan Stuntz" Date: Mon, 24 Jun 1996 19:23:38 +0100 X-Mailer: IntuiNews 1.3b Beta 7 (2.2.96) Subject: Re: DataSpace object -> AppObject ? Message-ID: <81322826@magic.informatik.tu-muenchen.de> Organization: Home of MUI Resent-Message-ID: <"P_hPa2.0.3R6.6ikpn"@susi> Resent-From: mui@sunsite.Informatik.RWTH-Aachen.de Reply-To: mui@sunsite.Informatik.RWTH-Aachen.de X-Mailing-List: archive/latest/1624 X-Loop: mui@sunsite.informatik.rwth-aachen.de Precedence: list Resent-Sender: mui-request@sunsite.Informatik.RWTH-Aachen.de Content-Type: text Content-Length: 247 X-Lines: 10 Status: RO mui-request wrote in article : > Why Dataspace objects can't be added to the application object ? The only allowed type of children for application class are windows objects. -- Greetings, Stefan